package com.alit.face.koala.controller.subject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.alit.face.koala.app.data.AppResponse;
import com.alit.face.koala.app.data.KoalaEmpLoyeeRequest;
import com.alit.face.koala.service.subject.SubjectService;

@RestController
@RequestMapping({ "subject" })
public class SubjectController {
  @Autowired
  private SubjectService subjectService;

  /**
   * 返回员工常量 
   */
  @RequestMapping("constants")
  public AppResponse constants(String category) {
    return subjectService.constants(category);
  }

  /**
   * 显示所有员工信息 
   */
  @RequestMapping("list")
  public AppResponse list(String category) {
    return subjectService.list(category);
  }

  @RequestMapping("avatar")
  public AppResponse avatar(MultipartFile avatar) {
    return subjectService.avatar(avatar);
  }

  @RequestMapping("photo")
  public AppResponse phtot(MultipartFile photo) {
    return subjectService.photo(photo);
  }

  /**
   * 添加用户 
   */
  @PostMapping({ "", "add" })
  public AppResponse add(@RequestBody KoalaEmpLoyeeRequest employee) {
    return subjectService.add(employee);
  }

  @DeleteMapping("{id}")
  public AppResponse delete(@PathVariable String id) {
    return subjectService.delete(id);
  }

  @GetMapping("{id}")
  public AppResponse get(@PathVariable String id) {
    return subjectService.get(id);
  }
  @PutMapping("{id}")
  public AppResponse edit(@PathVariable String id,@RequestBody KoalaEmpLoyeeRequest employee){
    return subjectService.edit(id,employee);
  }
}